<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link type="text/css" rel="stylesheet" href="css/style.css"/>
		<link href="css/font-awesome.min93e3.css" rel="stylesheet">
		<!--<link href="js/layer/theme/default/layer.css" rel="stylesheet">-->
		<link href="js/layui/css/layui.css" rel="stylesheet">
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript" src="js/layui/layui.all.js"></script>
	</head>
	<body>
		<div class="wrapper">
			<div class="home_head">
				<div class="head_left">
					<img src="img/home_logo.png" />
					<span>拜斯特积分系统</span>
				</div>
				<div class="head_right">
					<ul>
						<li class="topmenu on">申请积分</li>
						<li class="topmenu">积分审核</li>
						<li class="topmenu">今日积分</li>
						<li class="topmenu">积分排名</li>
					</ul>
					<div class="head_user"></div>
				</div>
			</div>
			<div class="home_content_wrapper">
				<div class="home_content_left">
					<ul class="leftmenu" id="leftmenu">
						
					</ul>
				</div>
				<div class="home_content_right">
					
				</div>
				
			</div>
		</div>
		<script>
			$(function(){
				$('.home_content_right').load('manage/setting/basicMana/jobMana.html', function() {});
				$.getJSON('data/menu.json',function(json){
					var htm='';
					$.each(json, function(i) {
						htm+='<li><a onclick="loadRight(true,this,'+json[i].url+')" href="javascript:;"><i class="fa '+json[i].icon+'"></i>'+
							'<span>'+json[i].title+'</span></a>';
						if(json[i].children!=undefined&&json[i].children.length>0){
							htm+=getChildHtm(json[i].children);
						}
						htm+='</li>';
					});
					$('#leftmenu').html(htm);
					$('.leftmenu').find('li').mouseenter(function(){
						if($(this).children('.sub_menu').length>0){
							$(this).children('.sub_menu').fadeIn();
						}
					})
					$('.leftmenu').find('li').mouseleave(function(){
						if($(this).children('.sub_menu').length>0){
							$(this).children('.sub_menu').fadeOut();
						}
					})
				})
				
			})
			function getChildHtm(data){
				var htm='<ul class="sub_menu">';
				$.each(data, function(i) {
					htm+='<li>';
					if(data[i].children!=undefined&&data[i].children.length>0){
						htm+='<a href="javascript:;"><i class="fa '+data[i].icon+'"></i>'+
						'<span>'+data[i].title+'</span></a>';
						htm+=getChildHtm(data[i].children);
					}else{
						htm+='<a onclick="loadRight(false,this,\''+data[i].url+'\')" href="javascript:;"><i class="fa '+data[i].icon+'"></i>'+
						'<span>'+data[i].title+'</span></a>';
					}
					htm+='</li>';
				});
				htm+='</ul>';
				return htm;
			}
			function loadRight(flag,obj,url){//flag=true  左侧第一级菜单
				
				if(flag==true){
					$('#leftmenu').children('li').removeClass('on');
					$(obj).parent().addClass('on');
				}
				if(url!=undefined&&url!=''){
					$('.home_content_right').load(url, function() {});
				}
			}
		</script>
	</body>
</html>
